package com.nwpu.am.mapper;

import org.apache.ibatis.annotations.*;
import com.nwpu.am.pojo.entity.*;

@Mapper
public interface PurchaseMapper {
    @Insert("INSERT INTO tb_purchase_item (purchase_item_id, user_id, suppliers_id, purchase_start_time, purchase_end_time, status) VALUES (#{purchaseItemId}, #{userId}, #{suppliersId}, #{purchaseStartTime}, #{purchaseEndTime}, #{status})")
    PurchaseItem insertPurchase(PurchaseItem purchaseItem);

    @Select("SELECT * FROM tb_purchase_item WHERE purchase_item_id = #{purchaseItemId}")
    PurchaseItem selectPurchaseById(int purchaseId);

    int updatePurchase(PurchaseItem purchaseItem);

    @Delete("DELETE FROM tb_purchase_item WHERE purchase_item_id = #{purchaseItemId}")
    int deletePurchaseById(int purchaseId);
}
